1. Field of the Invention
The present disclosure relates generally to an improved data processing system and in particular to a method and apparatus for processing data. Still more particularly, the present disclosure relates to a computer implemented method, apparatus, and computer usable program code for call stack sampling at a data processing system.
2. Description of the Related Art
In writing code, runtime analysis of the code is often performed as part of an optimization process. Runtime analysis is used to understand the behavior of components or modules within the code using data collected during the execution of the code. The analysis of the data collected may provide insight to various potential misbehaviors in the code. For example, an understanding of execution paths, code coverage, memory utilization, memory errors and memory leaks in native applications, performance bottlenecks, and threading problems are examples of aspects that may be identified through analyzing the code during execution.
The performance characteristics of code may be identified using a software performance analysis tool. The identification of the different characteristics may be based on a trace facility. A trace tool may use various techniques to provide information, such as execution flows, as well as other aspects of an executing program. A trace may contain data about the execution of code. For example, a trace may contain trace records about events generated during the execution of the code. A trace also may include information, such as a process identifier, a thread identifier, and a program counter. Information in the trace may vary depending on the particular profile or analysis that is to be performed. A record is a unit of information relating to an event that is detected during the execution of the code. In obtaining trace data, it is a common practice to obtain information about executing threads. This information may include call stack information obtained from call stacks associated with the threads of interest. Call stack information may be obtained from a virtual machine, such as a Java™ virtual machine. Java™ is a trademark of Sun Microsystems, Inc. There are many approaches for selectively instrumenting code for obtaining trace data. One approach is to replace the code using byte code instrumentation. Other approaches include dynamically patching code. The advantage of selectively instrumenting code is to minimize the overhead associated with executing the instrumentation code. Many approaches are presently used for obtaining call stack information. These approaches include using entry/exit events, an application timer tick, or instrumenting codes that sample the instrumented values.